/*
 * @Description:
 * @Author:  huangshuai
 * @Date: 2023-10-16 16:29:27
 * @LastEditTime: 2023-10-19 16:46:25
 * @LastEditors: huangshuai
 */
import axios from "@/utils/request";

//登录
export function userLogin(data: any) {
  return axios.service({
    url: "/user/login",
    method: "post",
    data,
  });
}
//获取用户列表
export function getListUserInfo(data: any) {
  return axios.service({
    url: "/user/listUserInfo",
    method: "post",
    data,
  });
}
export function userRegister(data: any) {
  return axios.service({
    url: "/user/registered",
    method: "post",
    data,
  });
}

export function updateUserInfo(data: any) {
  return axios.service({
    url: "/user/updateUserInfo",
    method: "put",
    data,
  });
}
//查询这天和这周内的用户访问数据数量
export function getUserLoginRecordNum() {
  return axios.service({
    url: "/user/getUserLoginRecordNum",
    method: "get",
  });
}
//获取特定用户信息
export function getThisUserInfo(userId: any) {
  return axios.service({
    url: `/user/getThisUserInfo/${userId}`,
    method: "get",
  });
}
//发送信息
export function addUserSendEmailContent(data: any) {
  return axios.service({
    url: "/email/addUserSendEmailContent",
    method: "post",
    data,
  });
}
//发送验证码
export function getSystemEmailCode(email: string) {
  return axios.service({
    url: `/email/getSystemEmailCode?email=${email}`,
    method: "get",
  });
}
//忘记密码
export function updateUserPassword(data: any) {
  return axios.service({
    url: "/user/updateUserPassword",
    method: "put",
    data,
  });
}
//收信页面
export function getListSenderUserInfo() {
  return axios.service({
    url: `/email/listSenderUserInfo`,
    method: "get",
  });
}
//点击==》用户之间的通信
export function getListUserEmailInfoBySenderId(
  page: number = 1,
  pageSize: number = 10,
  senderId: number | string
) {
  return axios.service({
    url: `/email/listUserEmailInfoBySenderId/${senderId}?page=${page}&pageSize=${pageSize}`,
    method: "get",
  });
}
//点击查看详情 ==》已读
export function getMessageDetailInfo(messageId: string | number) {
  return axios.service({
    url: `/email/getMessageDetailInfo/${messageId}`,
    method: "get",
  });
}
//撤回消息
export function updateMessageSendStatus(messageId: string | number) {
  return axios.service({
    url: `/email/updateMessageSendStatus/${messageId}`,
    method: "put",
  });
}
